<!DOCTYPE html>
<html>

	<head>
		<link rel="stylesheet" href="<?php echo APP_TEMPLATES_URL;?>/css/checkbix.min.css" />
		<link rel="stylesheet" href="<?php echo APP_TEMPLATES_URL;?>/css/public.css" />
		<script src="<?php echo APP_TEMPLATES_URL;?>/js/checkbix.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="<?php echo APP_TEMPLATES_URL;?>/js/common.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			Checkbix.init();
			$(function(){
				$(".close,.tanmu").click(
					function(){
						$(".tanmu").slideToggle();
						$(".tanmu2").slideToggle();
					});

				$("input[name=salebox]").click(function() {
					$("input[name=salebox]").each(function() {
						$(this).attr("checked", false);
					});
					$(this).attr("checked", true);
				});

				$("input[name='tuoguan_check']").click(function(){
					$("input[name='tuoguan_check']").each(function(){
						var a = $(this).siblings("input[type=hidden]");
						var v = a.val().split("|");
						if($(this)[0].checked){
							a.val(v[0]+"|1")
						}else{
							a.val(v[0]+"|0")
						}

					})
				});
			});

			function jfendHandle(){
				var zongji1 = Number($('#zongji').html());
				var point_m = Number(<?php echo $output['points_money']; ?>);
				var result_f1 = parseFloat(zongji1+point_m);
				var result_f2 = parseFloat(zongji1-point_m);

				if($("#jfeng_check").attr("checked") == "checked"){
					$('#zongji').html(result_f2.toFixed(2));
					$('#jfeng_use').val(<?php echo $output['member_points']; ?>);
				}else{
					$('#zongji').html(result_f1.toFixed(2));
					$('#jfeng_use').val(0);
				}
			}

			function goconfirm(){
				if($('#address_id').val()==''){
					alert('请添加收货地址');
					return;
				}
				var key = getCookie("key");
				var ifcart = "<?php echo $output['ifcart'] ?>";
				if (ifcart == 1) {
					var cart_id = "<?php echo $output['cart_id'] ?>"
				} else {
					var cart_id = $('#goods_id').val() + "|1"
				}
				var istg = $('#mycheckbox1').attr("checked")?1:0;

				$("#cart_id").val(cart_id);
				$("#key").val(key);
				$("#ifcart").val(ifcart);
				$("#tuoguan").val(istg);
				$('#pay_message').val($('#pay_message_t').val());

				$("#confirm_form").submit();
			}
			function handleDiv(){
				$(".tanmu").slideToggle();
				$(".tanmu2").slideToggle();
			}

			function determine(){
				$(".tanmu").slideToggle();
				$(".tanmu2").slideToggle();

				var total = Number($('#zongji').html());
				var voucher_price = $('#voucher_id').val().split("|")[2];
				$("input[name=salebox]").each(function() {
					if($(this).attr("checked")){
						if($(this).val()=='|<?php echo $_SESSION['store_id'];?>|0.00'){
							$('#voucher_label').html('不使用优惠券');
							$('#voucher_id').val($(this).val());
							$('#zongji').html(number_format(total+Number(voucher_price),2));
						}else{
							var index = $(this).val() .lastIndexOf("|");
							$('#voucher_label').html($(this).val() .substring(index + 1, $(this).val() .length)+'元优惠券');
							$('#voucher_id').val($(this).val());
							var cut = $(this).val() .substring(index + 1, $(this).val() .length);

							$('#zongji').html(number_format((total-cut),2));
						}
					}
				});
			}

		</script>

		<style>	
			body,html{
				background: #F4F4F4 !important;
			}
			.indexm {
				display: none;
			}
			.buttomcop {
				font-size: 20px;
				line-height: 70px;
				color: #FFFFFF;
				background: #f0b33e;
				float: left;
				text-align: center;
				width: 100%;
				margin-top: -1px;
			}

			.qujiesuan {
				background: #FFFFFF;
				position: fixed;
				bottom: 0px;
				width: 100%;
				border-top: 1px solid #EEEEEE;
			}

			.tanmu{background: rgba(0, 0, 0, 0.51); position: fixed; width: 100%; height: 100%; z-index: 990; top: 0; display: none;text-align: center;}
			.tanmu2{background: #FFFFFF; position: fixed; width: 100%;z-index: 996; bottom: 0; display: none;}
			.buttomcop{ font-size: 20px; line-height: 60px; color: #000000; background: #f0b33e; float: left; text-align: center; width: 100%;}
		</style>
	</head>

	<body style="padding-bottom: 5px;">

		<!-- 导航 -->
		<div class="mui-bar mui-bar-nav bj">
			<button id="zhuce" class="mui-btn mui-btn-link mui-btn-nav mui-pull-left zys mui-action-back">
				<img style=" max-width: 70%; vertical-align: middle;" src="<?php echo APP_TEMPLATES_URL;?>/images/back.png" />
			</button>
			<h1 class="mui-title"><label style="font-size: 18px;vertical-align: middle; line-height: 44px;">确认订单</label></h1>
		</div>

		<div class="mui-content mui-row mui-fullscreen mt45">

			<div style="background:#fff;">
				<div style="height: 10px; background: #F4F4F4; clear: both;"></div>
				<img class="fl" style="width: 100%;" src="<?php echo APP_TEMPLATES_URL;?>/images/dindan_02.png" />
				
				<?php if ($output['buy_list']['address_info']['address_id']) { ?>
					<table width="100%">
						<tr>
							<td colspan="2" height="25">
								<label><img src="<?php echo APP_TEMPLATES_URL;?>/images/dindan_02-02.png" style="vertical-align: middle; width: 20px;"></label>
								<label style="vertical-align: middle;"><?php echo $output['buy_list']['address_info']['true_name'] ?></label>
								<label style="margin-left: 20px;"><img src="<?php echo APP_TEMPLATES_URL;?>/images/dindan_02-03.png" style="vertical-align: middle; width: 16px;"></label>
								<label style="vertical-align: middle;"><?php echo str_cut($output['buy_list']['address_info']['mob_phone'],3).'****'.substr($output['buy_list']['address_info']['mob_phone'],7,4) ?></label>
							</td>
							<td rowspan="2" style="vertical-align: middle;"><a href="index.php?act=member&op=address"><img class="fanz" src="<?php echo APP_TEMPLATES_URL;?>/images/back.png" /></a></td>
						</tr>
						<tr>
							<td><label class="BD9F61_but">默认</label></td>
							<td>
								<p style="color: #666666;">收货地址：<?php echo $output['buy_list']['address_info']['area_info'] ?><?php echo $output['buy_list']['address_info']['address'] ?></p>
							</td>
						</tr>
						<tr>
							<td rowspan="2" style="height: 5px;"></td>
						</tr>
					</table>
				<?php }else{ ?>
					<a href="index.php?act=member&op=addaddress"><img class="fl" style="width: 100%;" src="<?php echo APP_TEMPLATES_URL;?>/images/add_address.jpg" /></a>
				<?php } ?>
				</div>
				<img class="fl" style="width: 100%;" src="<?php echo APP_TEMPLATES_URL;?>/images/dindan_02.png" />
			</div>

			<!--
            	作者：offline
            	时间：2016-11-17
            	描述：订单产品列表
            -->
		<form id="confirm_form" method="post" action="index.php">
			<div>

				<table width="100%">
					<?php foreach ($output['buy_list']['store_cart_list'] as $store_info) { ?>
						<?php foreach ($store_info['goods_list'] as $cart_info) { ?>
							<tr>
								<td colspan="3">
									<div style="height: 10px; background: #F4F4F4; clear: both;"></div>
								</td>
							</tr>

							<tr class="gouwuche">
								<td width="10" style="padding: 15px 10px 10px 10px;" class="veralignmiddle">
									<input type="hidden" id="goods_id" value="<?php echo $cart_info['goods_id']; ?>">
								</td>
								<td width="100" style="padding: 15px 0 10px 0;"><a href="index.php?act=goods&op=goods_detail&goods_id=<?php echo $cart_info['goods_id']; ?>"><img
										style=" width: 100px; border: 1px solid #EEEEEE !important;"
										src="<?php echo cthumb($cart_info['goods_image'],265); ?>"/></a></td>
								<td style="padding:12px 10px 10px 10px; vertical-align: top;">
									<p id="total2"
									   class="cor666666 ft14 linkh22"><?php echo $cart_info['goods_name']; ?></p>
									<p class="corbbbbbb ft13 marge20">金贵牌 999足银</p>
									<div>
										<span class="corc10a1f ft13">￥<label id="price"
																			 class="corc10a1f ft13"><?php echo $cart_info['goods_price']; ?></label></span>
										<span style="margin-left: 20px;"
											  class="corefb33e ft13">年收益<?php echo $cart_info['year_rate']; ?>%</span>
										<span class="fr ft13">x<label
												class="number text_box2to"><?php echo $cart_info['goods_num']; ?></label></span>
									</div>
								</td>
							</tr>

							<tr>
								<td colspan="3">
									<div>
										<ul class="across">
											<li class="side notactive" style="display: none;">
												<div class="countone notone">
													<a href="javascript:();">
														<label for="mycheckboxt_<?php echo $cart_info['goods_id']; ?>" style="background-size: 28px;width: 30px;">
															<nobr><input id="mycheckboxt_<?php echo $cart_info['goods_id']; ?>" type="checkbox" class="checkbix" data-shape="circled" name="tuoguan_check" data-color="orange" data-text=""><input type="hidden" name="tuoguan[]" value="<?php echo $cart_info['goods_id'];?>|0">&nbsp;托管</nobr></label><label for="mycheckboxt_<?php echo $cart_info['goods_id']; ?>" style="color: #BBBBBB;background-size: 26px;padding-bottom: 4px;">&nbsp;（即产品放平台保管，平台免收保管费）</label>
													</a>
												</div>
											</li>
										</ul>
									</div>
								</td>
							</tr>
						<?php }
					}?>

					<tr>
						<td colspan="3">
							<div style="height: 10px; background: #F4F4F4; clear: both;"></div>
						</td>
					</tr>					
				</table>

			</div>

			<div>
				<ul class="across">
					<li class="side">
						<div class="countone notone">
							<a href="#">
								<label>运费</label>
								<label style="text-align: right;">快递 免邮配送</label>
							</a>
						</div>
					</li>
					<li class="side notactive">
						<div class="countone">							
								<label style="width: 70px;">买家留言：</label>
								<label>
									<textarea id="pay_message_t" style="font-size: 14px; width: 100%;vertical-align: middle;border: 0; height: 45px; padding-top: 13px;" placeholder="选填，对本次交易的说明" ></textarea>
								</label>							
						</div>
					</li>
					<li class="side notactive">
						<div class="countone notone">
							<label class="textright">
								<label>共 <?php echo $output['cart_goods_num']?> 件商品</label>
							    <label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;合计：</label>
								<label class="corc10a1f">￥<?php echo $output['buy_list']['store_final_total_list']?></label>
							</label>
						</div>
					</li>
				</ul>
				<!--<div style="height: 10px; background: #F4F4F4; clear: both;"></div>
				<ul class="across">
					<li class="side notactive">
						<div class="countone notone">
							<a href="javascript:();">
								<label for="mycheckbox1" style="background: url(<?php /*echo APP_TEMPLATES_URL;*/?>/images/xiangqing_07.png) no-repeat right;background-size: 28px;" onclick="settuoguan(this)">是否托管</label>
							</a>
						</div>
						<div style="display: none;" id="tuoguan_div">
							<p class="corbbbbbb ft13 marge22" style="letter-spacing: 0.5px;">客户可以将购物的产品托管于平台仓库，平台将免收保管费！帮您解决存放问题，确保商品无损耗，保值更高效。</p>
							<label style="float: right;margin-top: 30px;font-size: 14px;padding-right: 15px;margin-bottom: 20px;">
								托管&nbsp; <input id="mycheckbox1" type="checkbox" class="checkbix" data-shape="circled" name="boxlist" data-color="orange" data-text="" value="8">
							</label>
						</div>
					</li>
				</ul>-->

				<div style="height: 10px; background: #F4F4F4; clear: both;"></div>
				<ul class="across">
					<li class="side">
						<div class="countone">
							<a href="#" onclick="handleDiv()">
								<label>我的优惠卷</label>
								<label style="text-align: right;" id="voucher_label">不使用优惠卷</label>
							</a>
						</div>
					</li>
				</ul>

				<div style="height: 10px; background: #F4F4F4; clear: both;display: none;"></div>
				<ul class="across" style="display: none;">
					<li class="side">
						<div class="countone">
								<label for="jfeng_check">可用<?php echo $output['member_points']; ?>积分抵 ￥<?php echo $output['points_money']; ?></label>
								<label style="text-align: right;" for="jfeng_check"><input type="checkbox" id="jfeng_check" class="checkbix" data-shape="circled" data-color="orange" data-text="" onclick="jfendHandle(this)"></label>
						</div>
					</li>
				</ul>

			</div>

		</div>
        <div style="height: 10px; background: #F4F4F4; clear: both;"></div>

		<div class="qujiesuan">
			<table width="100%">
				<tr>
					<td style="font-size: 14px; text-align: right;" class="veralignmiddle">
						<label class="cor666666">合计：</label><span class="corc10a1f">￥<label id="zongji" class="corc10a1f ft13"><?php echo $output['buy_list']['store_final_total_list']?></label></span>&nbsp;&nbsp;&nbsp;&nbsp;</td>
					<td width="138">
						<a class="buttomcop" href="javascript:void(0);" onclick="goconfirm()">确认订单</a>
					</td>
				</tr>
			</table>
		</div>


<div class="tanmu"></div>

<div class="tanmu2">
	<table width="100%">
		<tr style="border-bottom: 1px solid #DDDDDD;">
			<td width="120" style="padding: 20px 10px 10px 10px;"></td>
			<td style=" vertical-align:top; padding-top: 20px;padding-bottom: 10px;">
				<p style="font-size: 20px; ">我的优惠券</p>
			</td>
			<td width="28" style="vertical-align:top; "><img class="close" style=" width: 20px;" src="<?php echo APP_TEMPLATES_URL;?>/images/GG_06.jpg"/></td>
		</tr>
	</table>
	<ul class="across">
		<?php foreach ($output['buy_list']['store_cart_list'] as $store_info) { ?>
		<?php foreach ($store_info['store_voucher_list'] as $voucher) { ?>
		<li class="side">
			<div class="countone">
					<label style="font-size: 22px;color: #000000;width: 10px;"><nobr><?php echo $voucher['voucher_price'];?></nobr></label><label style="color: #666666;">&nbsp;元（<?php if ($voucher['voucher_limit'] > 0) { ?>消费满<?php echo $voucher['voucher_limit'];?>可用 <?php } ?>有效期至 <?php echo date('Y-m-d',$voucher['voucher_end_date']);?>）</label>
					<label style="text-align: right;" for="mycheckbox<?php echo $voucher['voucher_t_id'];?>"><input id="mycheckbox<?php echo $voucher['voucher_t_id'];?>" type="checkbox" class="checkbix" data-shape="circled" name="salebox" data-color="orange" data-text="" value="<?php echo $voucher['voucher_t_id'];?>|<?php echo $_SESSION['store_id'];?>|<?php echo $voucher['voucher_price'];?>"></label>
			</div>
		</li>
		<?php } } ?>

		<li class="side" >
			<div class="countone">
				<label style="color: #666666;">不使用优惠券</label>
				<label style="text-align: right;" for="mycheckbox9"><input id="mycheckbox9" type="checkbox" class="checkbix" data-shape="circled" name="salebox" data-color="orange" data-text="" value="|<?php echo $_SESSION['store_id'];?>|0.00"></label>
			</div>
		</li>
	</ul>
	<table width="100%">
		<tr style="border-bottom: 1px solid #DDDDDD;">
			<td><a class="buttomcop" href="#" onclick="determine();">确定</a></td>
		</tr>
	</table>
</div>


	<input id="act" name="act" type="hidden" value="order" />
	<input id="op" name="op" type="hidden" value="buy_step2" />
	<input id="key" name="key" type="hidden" value=""/>
	<input id="ifcart" name="ifcart" type="hidden" value="" />
	<input id="cart_id" name="cart_id" type="hidden" value=""/>
	<input id="address_id" name="address_id" type="hidden" value="<?php echo $output['buy_list']['address_info']['address_id']?>" />
	<input id="vat_hash" name="vat_hash" type="hidden" value="<?php echo $output['buy_list']['vat_hash']?>"/>
	<input id="offpay_hash" name="offpay_hash" type="hidden" value="<?php echo $output['buy_list']['address_api']['offpay_hash']?>" />
	<input id="offpay_hash_batch" name="offpay_hash_batch" type="hidden" value="<?php echo $output['buy_list']['address_api']['offpay_hash_batch']?>"/>
	<input id="pay_name" name="pay_name" type="hidden" value="online" />
	<input id="invoice_id" name="invoice_id" type="hidden" value=""/>
	<input id="pd_pay" name="pd_pay" type="hidden" value="0" />
	<input id="password" name="password" type="hidden" value=""/>
	<input id="fcode" name="fcode" type="hidden" value="" />
	<input id="rcb_pay" name="rcb_pay" type="hidden" value="0"/>
	<input id="rpt" name="rpt" type="hidden" value="" />

	<input type="hidden" name="voucher" id="voucher_id" value="|<?php echo $_SESSION['store_id'];?>|0.00">
	<input type="hidden" name="pay_message" id="pay_message" value="">

	<input type="hidden" name="jfeng_use" id="jfeng_use" value="0">

</form>


	</body>

</html>